import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Leetcode388 {

    public static void main(String[] args) {

    }

    public int lengthLongestPath(String input) {
        String[] paths = input.split("\n");
        int[] pathLens = new int[paths.length + 1];
        int ans = 0;
        for (String path : paths) {
            int level = path.lastIndexOf("\t") + 2, pathLen = path.length() - level + 1;
            pathLens[level] = pathLens[level - 1] + pathLen + 1;
            if (path.contains(".")) {
                ans = Math.max(ans, pathLens[level]);
            }
        }
        return Math.max(0, ans - 1);
    }
}
